<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>销售分析</title>
</head>
<body>

<div class="container">
    <div class="row">
        {% if data %}
            <div class="col-12">

                <h3 style="padding-bottom: 20px">销售汇总</h3>
                <form class="form-inline" method="get" action="{{ request.path }}" style="padding-bottom: 20px">
                    <div class="form-group">
                        <label for="date_start">开始日期</label>
                        <input type="date" class="form-control" id="date_start" name="date_start" value="{{ request.GET.date_start }}">
                    </div>
                    <div class="form-group">
                        <label for="date_end">截止日期</label>
                        <input type="date" class="form-control" id="date_end" name="date_end" value="{{ request.GET.date_end }}">
                    </div>
                    <button type="submit" class="btn btn-primary">获取</button>
                </form>
            </div>
            <div class="col-12">
                <table class="table table-striped table-bordered table-responsive">
                    <thead>
                        <tr>
                            <th>No.</th>
                            <th>姓名</th>
                            <th class="text-center">销售额（元）</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for m in data %}
                            <tr>
                                <td>{{ forloop.counter }}</td>
                                <td>{{ m.salesman }}</td>
                                <td class="text-center">{{ m.total_income|floatformat:"2" }}</td>
                            </tr>
                        {% endfor %}
                        <tr><th>合计：</th><td></td><td class="text-center">{{ data.total_material_costs|floatformat:"2" }}</td></tr>
                    </tbody>
                </table>
            </div>
        {% else %}
            <div class="col-12"><h3>你来自何方？</h3></div>
        {% endif %}
    </div>
</div>

</body>
</html>